// pages/friends/createAccount/index.ts
import tran from '../../../utils/language';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    _t: tran._t('eqTestResult'),
    navBarHeight: getApp().globalData.navBarHeight,
    region: {},
    isEdit: getApp().globalData.profileFrom === 'edit',
    partList: [
      {
        title: '自我意识评估',
        percentage: '61%',
      },
      {
        title: '自我调节评估',
        percentage: '62%',
      },
      {
        title: '社会意识评估',
        percentage: '75%',
      },
      {
        title: '社交技能评估',
        percentage: '80%',
      },
    ],
    info: {},
    techniqueList: []
  },
  /**
   * 点击完成
   */
  testOver () {
    console.log('完成测试')
  },
  onBack () {
    wx.switchTab({
      url: '/pages/metrics/index'
    })
  },
  backEq () {
    wx.switchTab({
      url: '/pages/metrics/index'
    })
  },
  addTechnique () {

  },
  resetTap () {
    const { info } = this.data
    const infoStr = JSON.stringify(info)
    wx.redirectTo({
      url: `/pages/profile/eqTestQuestion/index?info=${infoStr}`
    })
  },
  lookRecommend () {
    const { info } = this.data
    const infoStr = JSON.stringify(info)
    wx.navigateTo({
      url: `/pages/profile/recommendSkill/index?info=${infoStr}`
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options: any) {
    if (options) {
      let info = JSON.parse(options.info)
      let list: any = []
      if (info.scoreAssessments.length > 0) {
        info.scoreAssessments.map((item: any) => {
          if (item.selected) {
            list.push(item)
          }
        })
      }
      this.setData({
        info,
        partList: info.scoreAssessments,
        techniqueList: list
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})